Recently, there has been increased interest in decreasing the amount of memory that is used in computing devices, such as personal digital assistants (PDAs) and embedded appliances, to reduce their cost. Unfortunately, the amount of memory that is needed typically increases with the functionality that is provided. Therefore, the greater functionality (e.g., number of applications) the user desires, the more memory that typically is needed.
In view of this situation, several solutions have been proposed to reduce the amount of memory that is needed for computing devices. In one such solution, a microprocessor having a high code density can be used. Although facilitating a reduction in the amount of memory needed, this solution may impact the level of performance achievable by the microprocessor and is therefore undesirable for many applications.
A more promising solution involves the use of code compression. In code compression, program code is compressed off line, i.e., during the code build time. Once compressed, the program code requires less memory and therefore facilitates the reduction of the amount of memory that must be provided in the computing device. The compressed code is stored in, for example, permanent memory (e.g., read only memory (ROM), a hard disk, a flash device) and, when the code is to be executed, it is decompressed.
Where the computing device has limited memory, it is preferable to only decompress blocks (e.g., pages) of code at a time. To do otherwise would defeat the purpose of compressing in the first place at least as far as memory preservation is concerned. Decompression can be accomplished with hardware or software that is configured for that purpose. Although hardware solutions work adequately well, they are somewhat inflexible in that the hardware must be modified or, more likely, replaced each time the underlying system is changed.
Software-based solutions are also viable, but problematic in that they typically require modification of the operating system (O/S) and normally slow performance in that large portions of code usually must be decompressed, even where only a small amount of code (number of instructions) is needed. In addition to slowing performance, decompression of large portions of code further requires a relatively large amount of memory to be available for the decompressed code. Unfortunately, it is difficult to decompress smaller portions of code in that hardware support is typically needed to accomplish this. Even if such hardware were available, however, the overhead penalty and efficiency decrease that accompanies such a form of decompression would render such a solution unattractive.
From the foregoing, it can be appreciated that it would be desirable to have a system and method for decoding program code so as to, for example, provide code decompression that avoids one or more of the problems identified above.